<!DOCTYPE html>
<html>

<head>
  <title>Example</title>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <script>
  document.onreadystatechange = function() {
    if (document.readyState == "interactive") {
      document.getElementById("pressme").onclick = function() {
        document.getElementById("results").innerHTML = "Button Pressed";
      }
    }
  }
  </script>
</head>

<body>
  <button id="pressme">Press Me</button>
  <pre id="results"></pre>
</body>

</html>
